calculating the total number of factors